import * as TYPES from "../action-types";
import { Map } from "immutable";
let initState = Map({
  hotAlbums: [],
  topAlbums: [],
  topTotal: 0,
});
function albums(state = initState, action) {
  const { type, payload } = action;
  switch (type) {
    case TYPES.HOT_ALBUMS:
      return state.set("hotAlbums", payload);
    case TYPES.TOP_ALBUMS:
      const { total, albums } = payload;
      return state.set("topAlbums", albums).set("topTotal", total);

    default:
      return state;
  }
}

export default albums;
